# -*- coding: utf-8 -*-
"""
 Created by wq.wang on 2017/12/21
"""
import logging
import ujson

from sanic.request import Request

from wserver.base.wapi import WApi, CTYPE_JSON

_logger = logging.getLogger(__name__)


class SanicWApi(WApi):
    """

    """

    def parse_request(self, request: Request, *args, **kwargs):

        kwargs.update({k: request.raw_args for k in request.raw_args})
        if request.content_type in self.consumers:
            if request.content_type == CTYPE_JSON:
                kwargs.update(request.json)
        return kwargs
